/**
 */
package org.mro.grib.model.files.secondEdition.grids.impl;

import java.nio.ByteBuffer;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.mro.grib.model.files.secondEdition.grids.GridDefinitionTemplate31;
import org.mro.grib.model.files.secondEdition.grids.GridsPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Grid Definition Template31</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate31Impl#getLatitudeOfSouthernPoleOfProjection <em>Latitude Of Southern Pole Of Projection</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate31Impl#getLongitudeOfSouthernPoleOfProjection <em>Longitude Of Southern Pole Of Projection</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate31Impl#getAngleOfRotationOfProjection <em>Angle Of Rotation Of Projection</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class GridDefinitionTemplate31Impl extends GridDefinitionTemplate30Impl implements GridDefinitionTemplate31 {
	/**
	 * The default value of the '{@link #getLatitudeOfSouthernPoleOfProjection() <em>Latitude Of Southern Pole Of Projection</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLatitudeOfSouthernPoleOfProjection()
	 * @generated
	 * @ordered
	 */
	protected static final int LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getLatitudeOfSouthernPoleOfProjection() <em>Latitude Of Southern Pole Of Projection</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLatitudeOfSouthernPoleOfProjection()
	 * @generated
	 * @ordered
	 */
	protected int latitudeOfSouthernPoleOfProjection = LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT;

	/**
	 * The default value of the '{@link #getLongitudeOfSouthernPoleOfProjection() <em>Longitude Of Southern Pole Of Projection</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLongitudeOfSouthernPoleOfProjection()
	 * @generated
	 * @ordered
	 */
	protected static final int LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getLongitudeOfSouthernPoleOfProjection() <em>Longitude Of Southern Pole Of Projection</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLongitudeOfSouthernPoleOfProjection()
	 * @generated
	 * @ordered
	 */
	protected int longitudeOfSouthernPoleOfProjection = LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT;

	/**
	 * The default value of the '{@link #getAngleOfRotationOfProjection() <em>Angle Of Rotation Of Projection</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAngleOfRotationOfProjection()
	 * @generated
	 * @ordered
	 */
	protected static final int ANGLE_OF_ROTATION_OF_PROJECTION_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getAngleOfRotationOfProjection() <em>Angle Of Rotation Of Projection</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAngleOfRotationOfProjection()
	 * @generated
	 * @ordered
	 */
	protected int angleOfRotationOfProjection = ANGLE_OF_ROTATION_OF_PROJECTION_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GridDefinitionTemplate31Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GridsPackage.Literals.GRID_DEFINITION_TEMPLATE31;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getLatitudeOfSouthernPoleOfProjection() {
		return latitudeOfSouthernPoleOfProjection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLatitudeOfSouthernPoleOfProjection(int newLatitudeOfSouthernPoleOfProjection) {
		int oldLatitudeOfSouthernPoleOfProjection = latitudeOfSouthernPoleOfProjection;
		latitudeOfSouthernPoleOfProjection = newLatitudeOfSouthernPoleOfProjection;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE31__LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION, oldLatitudeOfSouthernPoleOfProjection, latitudeOfSouthernPoleOfProjection));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getLongitudeOfSouthernPoleOfProjection() {
		return longitudeOfSouthernPoleOfProjection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLongitudeOfSouthernPoleOfProjection(int newLongitudeOfSouthernPoleOfProjection) {
		int oldLongitudeOfSouthernPoleOfProjection = longitudeOfSouthernPoleOfProjection;
		longitudeOfSouthernPoleOfProjection = newLongitudeOfSouthernPoleOfProjection;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE31__LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION, oldLongitudeOfSouthernPoleOfProjection, longitudeOfSouthernPoleOfProjection));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getAngleOfRotationOfProjection() {
		return angleOfRotationOfProjection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAngleOfRotationOfProjection(int newAngleOfRotationOfProjection) {
		int oldAngleOfRotationOfProjection = angleOfRotationOfProjection;
		angleOfRotationOfProjection = newAngleOfRotationOfProjection;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE31__ANGLE_OF_ROTATION_OF_PROJECTION, oldAngleOfRotationOfProjection, angleOfRotationOfProjection));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				return getLatitudeOfSouthernPoleOfProjection();
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				return getLongitudeOfSouthernPoleOfProjection();
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__ANGLE_OF_ROTATION_OF_PROJECTION:
				return getAngleOfRotationOfProjection();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				setLatitudeOfSouthernPoleOfProjection((Integer)newValue);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				setLongitudeOfSouthernPoleOfProjection((Integer)newValue);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__ANGLE_OF_ROTATION_OF_PROJECTION:
				setAngleOfRotationOfProjection((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				setLatitudeOfSouthernPoleOfProjection(LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				setLongitudeOfSouthernPoleOfProjection(LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__ANGLE_OF_ROTATION_OF_PROJECTION:
				setAngleOfRotationOfProjection(ANGLE_OF_ROTATION_OF_PROJECTION_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				return latitudeOfSouthernPoleOfProjection != LATITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT;
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION:
				return longitudeOfSouthernPoleOfProjection != LONGITUDE_OF_SOUTHERN_POLE_OF_PROJECTION_EDEFAULT;
			case GridsPackage.GRID_DEFINITION_TEMPLATE31__ANGLE_OF_ROTATION_OF_PROJECTION:
				return angleOfRotationOfProjection != ANGLE_OF_ROTATION_OF_PROJECTION_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (latitudeOfSouthernPoleOfProjection: "); //$NON-NLS-1$
		result.append(latitudeOfSouthernPoleOfProjection);
		result.append(", longitudeOfSouthernPoleOfProjection: "); //$NON-NLS-1$
		result.append(longitudeOfSouthernPoleOfProjection);
		result.append(", angleOfRotationOfProjection: "); //$NON-NLS-1$
		result.append(angleOfRotationOfProjection);
		result.append(')');
		return result.toString();
	}

	/* (non-Javadoc)
	 * @see org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate30Impl#initialise(java.nio.ByteBuffer)
	 */
	@Override
	public void initialise(ByteBuffer buffer) {
		super.initialise(buffer);
		latitudeOfSouthernPoleOfProjection = buffer.getInt();
		longitudeOfSouthernPoleOfProjection = buffer.getInt();
		angleOfRotationOfProjection = buffer.getInt();
	}
	
} //GridDefinitionTemplate31Impl
